function [ ret ] = hilbert_envelope_cc( dat1,dat2 )

    signal_h = hilbert(dat1);

    % square the hilbert transform and take the
    % +ve square root to get the estimated envelope
    dat1 = (sqrt(signal_h.*conj(signal_h)))';
    
    signal_h = hilbert(dat2);

    % square the hilbert transform and take the
    % +ve square root to get the estimated envelope
    dat2 = (sqrt(signal_h.*conj(signal_h)))';
   

    cs = corrcoef(dat1,dat2);
    ret = cs(1,2);
    
end

